Skip to content

fix: InScenePlaced edge cases#4073

Merged
EmandM merged 10 commits into
develop-2.0.0from
fix/in-scene-placed-edge-cases
Jul 16, 2026
Merged

fix: InScenePlaced edge cases#4073
EmandM merged 10 commits into
develop-2.0.0from
fix/in-scene-placed-edge-cases

Conversation

@EmandM

@EmandM EmandM commented Jul 10, 2026

Copy link
Copy Markdown
Member

Purpose of this PR

Fixes handling of edge cases around InScenePlaced value.

Jira ticket

UUM-146506
fixes: #4049

Changelog

  • Fixed: Manually spawned InScenePlaced objects are now considered dynamic spawns.
  • Fixed: Objects moved into the scene in Awake should not be considered InScenePlaced.
  • Fixed: InScenePlaced value should always be server authoritative.
  • Changed: Added some warnings around strange Prefab registration cases.

Documentation

  • No documentation changes or additions were necessary.

Testing & QA (How your changes can be verified during release Playtest)

Functional Testing

Manual testing :

  • Manual testing done

Automated tests:

  • Covered by existing automated tests
  • Covered by new automated tests

Does the change require QA team to:

  • Review automated tests?
  • Execute manual tests?
  • Provide feedback about the PR?

If any boxes above are checked the QA team will be automatically added as a PR reviewer.

Backports

n/a

@EmandM EmandM requested a review from a team as a code owner July 10, 2026 23:35
@codecov-github-com

codecov-github-com Bot commented Jul 14, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

Comment thread com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs Outdated
@EmandM EmandM enabled auto-merge (squash) July 14, 2026 21:30
* fix

- Adjusted the `InScenePlaced` property to internally set or publicly get the serialized `m_InScenePlaced` field.
- `NetworkObject` now implements `ISerializationCallbackReceiver` to assure `m_InScenePlaced` is always properly set for in-scene placed objects.
- Removed legacy define for UNITY_2021_2_OR_NEWER since v2.x.x+ is only for Unity v6.

* test

- Adding `NetworkSceneManagerStartupTests` which validates this PR.
- Adding the assets and script needed to validate this PR.
- Updated scenes in build list to include the new scene: InSceneNetworkObjectMovesToDDOL.

* update

Adding change log entry.

* fix

Fixing issue with marking things as in-scene placed during runtime.

* update

Commenting out the addressable scene test.
Adding back the check for InScenePlaced when shutting down.

* revert and update

- `ISerializationCallbackReceiver` implementation as that does not accomplish what we need.
- Setting InScenePlaced within OnValidate instead.

* fix

Only reset things that have been spawned are in-scene placed, and is assigned to the relative NetworkManager (for integration testing purposes)

* update

Removing the addressable scene.
We will revisit this when this is supported.

* fix and style

Fixing several issues with NetworkObjectSceneMigrationTests.
Fixing several formatting issues.

* style

brackets adjustment.

* style

Adding white spaces between foreach and if

* style

Fixing some out of alignment if statements.

* style

Didn't save the change... adding last standards check issue fix.

* fix

Fixing issue where we were sending scene migration notifications when migrating into the DDOL.
Fixing issue where if a client detected a changed scene but had no scene change to send (later) it would throw and exception and cause a memory leak.

* update

Remove the legacy multiprocess scene that is no longer used and has references to scripts that no longer exist.

* fix

Issue where distributed authority would throw an exception during scene migration due to the fact that we would throw an exception if the 1st scene in the scene migration table didn't contain the client that has authority over the NetworkObject that migrated into a new scene. Now we count how many entries were written and if that count is zero upon parsing known loaded scenes then it throws an exception.

Reverting the exclusion of DDOL synchronization (that was a red herring).

* test - fix

Removing the ValidateSceneOnAllClients portion as that doesn't assure that all clients have loaded the scene and fully synchronized the scene which could lead to edge case issues during this test.

* update

Adding and updating the change log entries for this PR.

@NoelStephensUnity NoelStephensUnity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything should pass with the combined fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.13.0] Default Player Prefab causes "In-Scene placed NetworkObject soft synchronization failure"

2 participants